<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="./js/vue.js"></script>
</head>

<body>
    <!-- 
        计算属性：
            形式：方法形式，实际存储的时方法的返回值
            仅在创建VUE对象或修改关联属性时调用1次，后续调用都是直接从内存中取值

     -->
    <div id="app">
        <p>{{msg}}</p>
        <p>{{msgAttr}}</p>
        <p>{{msgMd()}}</p>
    </div>
    <script>
        let vm = new Vue({
            el: "#app",
            data: {
               msg:"足球，篮球"
            },
            computed:{
                msgAttr:function(){
                    return this.msg.replace("，","、");
                }
            },
            methods:{
                msgMd:function(){
                    return this.msg.replace("足","排");
                }
            }
        })
    </script>
</body>

<html>